package com.example.bysj_sb.service;

import com.example.bysj_sb.dao.GraduateProjectTypeDao;
import com.example.bysj_sb.domain.GraduateProjectTrueness;
import com.example.bysj_sb.domain.GraduateProjectType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("graduateProjectTypeService")
//@Transactional注解：可以用在方法上和类上，用在类上代表这个类的所有公共非静态方法都将启用事务功能。
@Transactional(isolation = Isolation.READ_COMMITTED, propagation = Propagation. REQUIRED)
public class GraduateProjectTypeService {
    @Autowired
    private GraduateProjectTypeDao graduateProjectTypeDao;

    //添加
    public Boolean add(GraduateProjectType graduateProjectType){
        return graduateProjectTypeDao.add(graduateProjectType);
    }
    //根据id查找
    public GraduateProjectType find(int id){
        GraduateProjectType graduateProjectType = graduateProjectTypeDao.find(id);
        return graduateProjectType;
    }
    //查找全部
    public List<GraduateProjectType> findAll(){
        List<GraduateProjectType> graduateProjectTypes = graduateProjectTypeDao.findAll();
        return graduateProjectTypes;
    }
    //修改
    public Boolean update(GraduateProjectType graduateProjectType){
        return graduateProjectTypeDao.update(graduateProjectType);
    }
    //删除
    public Boolean delete(int id){
        return graduateProjectTypeDao.delete(id);
    }
}